(function() {
	var href = window.location.href;
	basePath = href.substring(0, href.indexOf("www"));
	basePath += "www/";
	document
			.write("<meta name='viewport' content='width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=2'/>");
	document
			.write("<link rel='stylesheet' href='"
					+ basePath
					+ "js/lib/jquery.mobile-1.3.2/jquery.mobile-1.3.2.min.css' type='text/css'/>");
	document.write("<link rel='stylesheet' href='" + basePath
			+ "css/main.css' type='text/css'/>");

	document.write("<script type='text/javascript' src='" + basePath
			+ "js/lib/jquery-1.8.3.min.js'></script>");
	document
			.write("<script type='text/javascript' src='"
					+ basePath
					+ "js/lib/jquery.mobile-1.3.2/jquery.mobile-1.3.2.min.js'></script>");
	document.write("<script type='text/javascript' src='" + basePath
			+ "js/common.js'></script>");
	document.documentElement.style.webkitUserSelect = 'none';// 禁止选中
})();

/**
 * 获取设备信息回调方法
 * 
 * @param {}
 *            data, 返回通信模块信息
 */
var getDeviceInfoCallback = function(data) {
	// 启用按钮
	$("#refreshbtn").button("enable");
	$("#refreshbtn").val("刷新").button("refresh");
	$("#readcommaddrbtn", $("#commtestcontent")).button("enable");

	data = JSON.parse(data);

	$("#devicename", $("#commtestcontent")).val(data.name);
	$("#serialno", $("#commtestcontent")).val(data.serialNumber);

	if ("1" == data.status) {
		$("#devicestatus", $("#commtestcontent")).val("模块正常");
		$("#commaddr", $("#commtestcontent")).val(data.commAddr);
	} else {
		$("#devicestatus", $("#commtestcontent")).val("模块不可用");
		$("#commaddr", $("#commtestcontent")).val(""); // 模块不可用时清空通信地址
	}
};